import { filterDate } from "@/unit/tool";
// 格式化
function format(value) {
  if(value == 1){
    return value = "已完成"
  }else {
    return value = "未完成"
  }
}
const columns = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    customRender: (text, record, index) => `${index + 1}`,
    align: "center",
  },
  {
    title: "加工单号",
    dataIndex: "worksheetNum",
    key: "worksheetNum",
    align: "center",
  },
  {
    title: "机床编号",
    dataIndex: "equipmentNumber",
    key: "equipmentNumber",
    align: "center",
  },
  {
    title: "数量",
    dataIndex: "productionQuantity",
    key: "productionQuantity",
    align: "center",
  },
  // {
  //   title: "计划编号",
  //   dataIndex: "planNum",
  //   key: "planNum",
  //   align: "center",
  // },

  {
    title: "开始时间",
    dataIndex: "processStartTime",
    key: "processStartTime",
    align: "center",
    customRender: (text, record, index) => {
      return filterDate(text);
    },
  },
  {
    title: "结束时间",
    dataIndex: "processEndTime",
    key: "processEndTime",
    align: "center",
    customRender: (text, record, index) => {
      return filterDate(text);
    },
  },
  {
    title: "商品名称",
    dataIndex: "goodsName",
    key: "goodsName",
    align: "center",
  },
  {
    title: "工序名称",
    dataIndex: "workStageName",
    key: "workStageName",
    align: "center",
  },
  {
    title: "工序序号",
    dataIndex: "sort",
    key: "sort",
    customRender: (text, record, index) => `${text + 1}`,
    align: "center",
  },
  {
    title: "状态",
    dataIndex: "wsRelationState",
    key: "wsRelationState",
    align: "center",
    customRender: (text, record, index) => {
      return format(text);
    },
  },
  {
    title: "操作",
    dataIndex: "action",
    align: "center",
    scopedSlots: { customRender: "action" },
  },
];

const column = [
  {
    title: "设备编号",
    dataIndex: "equipmentNumber",
    key: "equipmentNumber",
    align: "center",
  },
  {
    title: "设备名称",
    dataIndex: "equipmentName",
    key: "equipmentName",
    align: "center",
  },
  {
    title: "设备型号",
    dataIndex: "equipmentModel",
    key: "equipmentModel",
    align: "center",
  }
];

export { columns ,column};
